package com.walterlife.springmvc.simple;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class SimpleController {

    // 使用 path param
    //@RequestMapping(value = "/simple/{name}")
    //public @ResponseBody String simple(@PathVariable String name, Model model) {
        //return "get simple name: " + name;
    //} 

    // 使用key-value param
    @RequestMapping(value = "/simple/")
    public @ResponseBody String simple(@RequestParam("name") String name, Model model) {
        return "get simple name: " + name;
    } 
}
